package order.servlet;

import order.entity.Orderbiao;
import order.service.OrderbiaoService;
import order.service.impl.OrderbiaoServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet("/UpdServlet")
public class UpdServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String idStr=request.getParameter("id");
        int id=idStr!=null?Integer.parseInt(idStr):0;

        OrderbiaoService service=new OrderbiaoServiceImpl();

        Orderbiao o=new Orderbiao();
        o.setId(id);

        int count=service.UpOrder(o);

        PrintWriter out=response.getWriter();
        out.print(count);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request,response);
    }
}
